<?php
namespace App\Http\Controllers\Rating;

use App\Http\Controllers\Controller;
use App\Common\Utils\JsonResponse;
use Illuminate\Http\Request; 

class CheckController extends Controller{

    private $Request;
    private $logService;
    private $checkService;
  
    public function __construct(Request $Request)
    {
        parent::__construct();
      
        /** @var \App\Services\Rating\CheckService $checkService */
        $this->checkService = app('checkService');
        $this->Request = $Request;
        /** @var \App\Services\System\LogService $logService */
        $this->logService = app('logService');
    }

    /**
     * 列表
     * @author lxy
     * @datetime 2023-07-07
     */
    public function getCheckList()
    {
        try{
            $result = $this->checkService->getCheckList($this->Request->all());
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 添加
     * @author lxy
     * @datetime 2023-03-08
     */
    public function addCheck()
    {
        try{
            $result = $this->checkService->addCheck($this->Request->all());
            if(!empty($this->Request->all()['id'])){
                $this->logService->log('327','学年考核编辑', "学年考核编辑");
            }else{
                if($this->Request->all()['status'] ==1){
                    $this->logService->log('325','学年考核提交', "学年考核提交");
                }else{
                    $this->logService->log('325','学年考核保存', "学年考核保存");
                }               
            } 
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

     /**
     * 选择量表
     * @author lxy
     * @datetime 2023-03-10
     */
    public function getCheckScale()
    {
        try{
            $result = $this->checkService->getCheckScale($this->Request->all());
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 获取一条数据
     * @author lxy
     * @datetime 2023-07-07
     */
    public function getCheckFirst()
    {
        try{
            $result = $this->checkService->getCheckFirst($this->Request->all());
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 获取申报教师列表
     * @author lxy
     * @datetime 2023-07-10
     */
    public function getCheckTeachersList()
    {
        try{
            $result = $this->checkService->getCheckTeachersList($this->Request->all());
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 获取教师基础信息
     * @author lxy
     * @datetime 2023-07-10
     */
    public function getTeacherBaseInfo()
    {
        try{
            $result = $this->checkService->getTeacherBaseInfo($this->Request->all());
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 获取评分量表
     * @author lxy
     * @datetime 2023-07-10
     */
    public function getCheckScaleInfo()
    {
        try{
            $result = $this->checkService->getCheckScaleInfo($this->Request->all());
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 打分
     * @author lxy
     * @datetime 2023-07-11
     */
    public function checkScores()
    {
        try{
            $result = $this->checkService->checkScores($this->Request->all());
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 获取最终认定
     * @author lxy
     * @datetime 2023-07-12
     */
    public function getFinalScores()
    {
        try{
            $result = $this->checkService->getFinalScores($this->Request->all());
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 获取审核小组评分
     * @author lxy
     * @datetime 2023-07-13
     */
    public function getCheckScores()
    {
        try{
            $result = $this->checkService->getCheckScores($this->Request->all());
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 排序
     * @author lxy
     * @datetime 2023-07-13
     */
    public function setCheckSort()
    {
        try{
            $result = $this->checkService->setCheckSort($this->Request->all());
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 删除
     * @author lxy
     * @datetime 2023-07-14
     */
    public function delCheck()
    {
        try{
            $result = $this->checkService->delCheck($this->Request->all());
            $this->logService->log('328','学年考核删除', "学年考核删除");
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 审核列表导出
     * @author lxy
     * @datetime 2023-07-14
     */
    public function checkTeacherExport()
    {
        try{
            $result = $this->checkService->checkTeacherExport($this->Request->all());
            $this->logService->log('329','学年考核导出', "学年考核导出");
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 导出
     * @author lxy
     * @datetime 2023-07-19
     */
    public function checkExport()
    {
        try{
            $result = $this->checkService->checkExport($this->Request->all());
            $this->logService->log('329','学年考核导出', "学年考核导出");
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 汇总表导出
     * @author lxy
     * @datetime 2023-08-11
     */
    public function finalExport()
    {
        try{
            $result = $this->checkService->finalExport($this->Request->all());
            //$this->logService->log('329','学年考核导出', "学年考核导出");
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 复用
     * @author lxy
     * @datetime 2024-04-09
     */
    public function copyCheck()
    {
        try{
            $result = $this->checkService->copyCheck($this->Request->all());
            $this->logService->log('353','学年考核复用', "学年考核复用");
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 删除组员
     * @author lxy
     * @datetime 2024-06-18
     */
    public function checkMemberDel()
    {
        try{
            $result = $this->checkService->checkMemberDel($this->Request->all());          
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 获取组员
     * @author lxy
     * @datetime 2024-06-18
     */
    public function getcheckMember()
    {
        try{
            $result = $this->checkService->getcheckMember($this->Request->all());          
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

    /**
     * 添加组员
     * @author lxy
     * @datetime 2024-06-19
     */
    public function addCheckMember()
    {
        try{
            $result = $this->checkService->addCheckMember($this->Request->all());          
            return JsonResponse::success($result,'操作成功');
        }catch(\Exception $e){
            return JsonResponse::error($e->getMessage());
        }
    }

   

}